package com.wd.live.module_wide.view.adapter

import android.content.Context

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.wd.live.module_base.net.bean.wide.FindLiveListBean
import com.wd.live.module_wide.R
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 * 作者: 王晶晶
 * 时间:2024/5/22
 * 描述:
 */
class FindLiveListAdapter(context: Context?, layoutId: Int, datas: MutableList<FindLiveListBean>?) :
    CommonAdapter<FindLiveListBean>(context, layoutId, datas) {
    override fun convert(holder: ViewHolder?, t: FindLiveListBean?, position: Int) {
       holder?.setText(R.id.live_list_content,t?.liveTitle)
       holder?.setText(R.id.live_list_name,t?.nickName)

        holder?.getView<ImageView>(R.id.live_list_img)?.let {
            Glide.with(mContext)
                .load(t?.liveCoverUrl)
                .apply(RequestOptions.bitmapTransform( RoundedCorners(20)))
                .into(it)

        }
        //直播状态 1=直播中 2=录播
        if (t?.liveStatus==1){
            holder?.setText(R.id.live_list_status,"直播中")
        }else if (t?.liveStatus==2){
            holder?.setText(R.id.live_list_status,"录播")
        }
    }
}